import request from "@/utils/request";

// 获取活动列表
export function getEventList(params) {
	return request({
		url: "/CommunityEvent",
		method: "get",
		params,
	});
}

// 获取活动详情
export function getEvent(id) {
	return request({
		url: `/CommunityEvent/${id}`,
		method: "get",
	});
}

// 创建活动
export function createEvent(data) {
	return request({
		url: "/CommunityEvent",
		method: "post",
		data,
	});
}

// 更新活动
export function updateEvent(id, data) {
	return request({
		url: `/CommunityEvent/${id}`,
		method: "put",
		data,
	});
}

// 删除活动
export function deleteEvent(id) {
	return request({
		url: `/CommunityEvent/${id}`,
		method: "delete",
	});
}

// 报名活动
export function registerEvent(id) {
	return request({
		url: `/CommunityEvent/${id}/register`,
		method: "post",
	});
}

// 取消报名
export function cancelEventRegistration(id) {
	return request({
		url: `/CommunityEvent/${id}/register`,
		method: "delete",
	});
}
